home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Mac Game Programming Gurus / TricksOfTheMacGameProgrammingGurus.iso / More Source / C⁄C++ / FlightSim / flight.h < prev    next >
Text File  |  1992-12-11  |  2KB  |  109 lines

  1. /*
  2. #include <Quickdraw.h>
  3. #include <Events.h>
  4. #include <Windows.h>
  5. #include <Files.h>
  6. */
  7.  
  8. #include <math.h>
  9. #include <FixMath.h>
  10.  
  11.  
  12. #define NOT        !
  13. #define AND        &&
  14. #define NEQ        !=
  15. #define EQ        ==
  16. #define OR        ||
  17. #define COMP    ~
  18. #define MOD        %
  19. #define SQ(x)    ((x)*(x))
  20. #define NIL        (0L)
  21.  
  22. #define ASCIItoNUM(x)    ((x)-48)
  23. #define NUMtoASCII(x)    ((x)+48)
  24.  
  25. //char    *PtoCstr();
  26. //char    *CtoPstr();
  27. #define    ptoc(x)        PtoCstr(x)
  28. #define    ctop(x)        CtoPstr(x)
  29.  
  30. #define    DeBug()    asm{dc.w 43519}
  31.  
  32.  
  33.  
  34. /* menus */
  35. #define MENU_APPLE    1
  36. #define MENU_FILE    2
  37. #define MENU_EDIT    3
  38.  
  39.  
  40. /* windows */
  41. #define MENU_BAR_HEIGHT    20
  42. #define SCREEN_WIDTH    512
  43. #define SCREEN_HEIGHT    342
  44. #define SCREEN_MARGIN    4
  45. #define TITLE_BAR_HEIGHT    18    
  46. #define inZoomIn    7
  47. #define inZoomOut    8
  48.  
  49. #define WIND_MAIN    128
  50. #define ALRT_ABOUT    128
  51.  
  52.  
  53. #define    MOUSE_POS    (*(Point *)(0x830))
  54.  
  55. #define    GRID_SZ        10
  56.  
  57. struct Vector {
  58.     double    x;
  59.     double    y;
  60.     double    z;
  61. };
  62. typedef struct Vector Vector;
  63.  
  64. struct FxVector {
  65.     Fixed    x;
  66.     Fixed    y;
  67.     Fixed    z;
  68. };
  69. typedef struct FxVector FxVector;
  70.  
  71. typedef double ThreeMatrx[3][3];
  72. typedef Fixed FxThreeMatrx[3][3];
  73. typedef Fract FracThreeMatrx[3][3];
  74.  
  75. struct FracThreeMatrxStrc {
  76.     Fract    entrys[3][3];
  77. };
  78. typedef struct FracThreeMatrxStrc FracThreeMatrxStrc;
  79.  
  80. struct FxGridMatrx {
  81.     FxVector    entrys[GRID_SZ][GRID_SZ];
  82. };
  83. typedef struct FxGridMatrx FxGridMatrx;
  84.  
  85.  
  86. #define    FIX_HALF    (0x8000)
  87. #define    FIX_ONE        (0x10000)
  88. #define    FRAC_ONE    (0x40000000)
  89. #define    FIX_NG_ONE    (0xffff0000)
  90. #define    FixToD(x)    ldexp((double)(x),-16)
  91. #define    DToFix(x)    ((long)ldexp((x),16))
  92. #define    FixToi(x)    ((int)((x)>>16))
  93. #define    RndFixToi(x)    ((int)((x)+FIX_HALF>>16))
  94.  
  95. #define    iToFix(x)    (((long)(x)<<16))
  96. #define    FixRound(x)    FixToi(x)
  97. #define    Frac2Fix(x)    ((x)>>14)
  98. #define    Fix2Frac(x)    ((x)<<14)
  99. #define    FracToD(x)    ldexp((double)(x),-30)
  100. #define    DToFrac(x)    ((long)ldexp((x),30))
  101. #define    Fx_DEGtoRAD    ((long)0x477)
  102.  
  103. Fixed    _FixMul(), _FixDiv();
  104.  
  105.  
  106.  
  107. #define        stepSize    2
  108. #define        startHeight        4
  109.